<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录界面</title>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
</head>
<body>
	<form id='form'>
		<table>
			<tr>
				<td>用户名：</td>
				<td><input id='username' /></td>
			</tr>
			<tr>
				<td>密码：</td>
				<td><input id='password'/></td>
			</tr>
			<tr>
				<td>
					<button onclick="login()">登录</button>
				</td>
				<td>
					<button onclick="register()">注册</button>
				</td>
			</tr>
		</table>
	</form>
<script>
	function login(){
		$.ajax({
			url:'loginController.login.do',
			type:'post',
			data:{username:$('#username').val(),password:$('#password').val()},
			success:function(result){
				alert(result);
			}
		});
	}
	function register(){
		$.ajax({
			url:'loginController.register.do',
			type:'post',
			data:[
				{name:'user.username',value:$('#username').val()},
				{name:'user.password',value:$('#password').val()}
				]
		});
	}
</script>
</body>
</html>